
import 'package:json/json.dart';

import '../bean.dart';

part 'ble_device.g.dart';

@Json()
class BleDevice{
  String? name;
  String? address;

  BleDevice.fromMap(Map<String, dynamic>? map){
    _fromMap(map, this);
  }

  BleDevice.from(AudioDevice device):
      name = device.name,
      address = device.id.length > 17
          ? device.id.substring(0, 17)
          : device.id
  ;

  @override
  String toString() {
    return 'BleDevice{name: $name, address: $address}';
  }
}